﻿using System.Linq;
using FluentNHibernate.Automapping;
using FluentNHibernate.Automapping.Alterations;

namespace NMA.Infrastructure.NHibernate.Mapping.Override
{
    using NMA.Infrastructure.NHibernate.DomainObject;

    public class CategoryMappingOverride : IAutoMappingOverride<Category>
    {     
        public void Override(AutoMapping<Category> mapping)
        {
            mapping.HasMany<News>(x => x.News).KeyColumn("ID")
                .AsList()
                .Inverse().Cascade.All();     
        }
    }
}
